﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EntregaSO.GUI.Controles
{
    public partial class Ascensor : UserControl
    {
        #region Atributos del control
        private int cantPisos = 1;
        private List<Control> ascensores = new List<Control>();
        
        [BrowsableAttribute(true)]
        public int CantidaPisos
        {
            get { return this.cantPisos; }
            set 
            {
                int cantAnterior = this.cantPisos;
                this.cantPisos = value;
                this.Size = new System.Drawing.Size(84, 63 * cantPisos);
                for (int i = 0; i < cantAnterior; i++)
                {
                   this.Controls.RemoveByKey("grpPisoNuevo" + i);
                }
                this.ReDraw();
                for (int i = 0; i < cantPisos; i++)
                {
                    System.Windows.Forms.GroupBox grpPisoNuevo = new System.Windows.Forms.GroupBox();
                    grpPisoNuevo.Location = new System.Drawing.Point(7, this.Size.Height - 70 * i);
                    grpPisoNuevo.Name = "grpPisoNuevo" + i;
                    grpPisoNuevo.Size = new System.Drawing.Size(74, 4);
                    grpPisoNuevo.TabStop = false;

                    this.Controls.Add(grpPisoNuevo);
                }
            }
        }

        #endregion

        public Ascensor()
        {
            InitializeComponent();
        }

        private void ReDraw()
        {
            //this.Controls.Clear();
            //this.picAscensor = new System.Windows.Forms.PictureBox();
            //this.picAscensor.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
            //this.picAscensor.Image = global::EntregaSO.Properties.Resources.elevator;
            //this.picAscensor.Location = new System.Drawing.Point(34, 8);
            //this.picAscensor.Name = "picAscensor";
            //this.picAscensor.Size = new System.Drawing.Size(47, 50);
            //this.picAscensor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            //this.picAscensor.TabIndex = 0;
            //this.picAscensor.TabStop = false;
        }

        private void Ascensor_Load(object sender, EventArgs e)
        {
        }

        private void picAscensor_Click(object sender, EventArgs e)
        {

        }

        private void Ascensor_Resize(object sender, EventArgs e)
        {
            this.picAscensor.Location = new System.Drawing.Point(34, this.Size.Height - this.picAscensor.Size.Height - 8);
            this.picPersona.Location = new System.Drawing.Point(7, this.Size.Height - this.picPersona.Size.Height - 8);
            this.grpPiso.Location = new System.Drawing.Point(7, this.Size.Height - 70);
        
        }
    }
}
